package com.demo.security.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/auth")
public class AuthController {

    @RequestMapping("/admin")
    @PreAuthorize("hasAnyRole('ADMIN')")
    public void roleAdmin() {
        System.out.println("admin");
    }

    @RequestMapping("/user")
    @PreAuthorize("hasAnyRole('USER')")
    public void roleUser() {
        System.out.println("admin");
    }
}
